import request from '@/utils/request'

// 创建供应商
export function createSupplier(data) {
  return request({
    url: '/basic/supplier/create',
    method: 'post',
    data: data
  })
}

// 更新供应商
export function updateSupplier(data) {
  return request({
    url: '/basic/supplier/update',
    method: 'put',
    data: data
  })
}

// 删除供应商
export function deleteSupplier(id) {
  return request({
    url: '/basic/supplier/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除供应商 */
export function deleteSupplierList(ids) {
  return request({
    url: `/basic/supplier/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得供应商
export function getSupplier(id) {
  return request({
    url: '/basic/supplier/get?id=' + id,
    method: 'get'
  })
}

// 获得供应商分页
export function getSupplierPage(params) {
  return request({
    url: '/basic/supplier/page',
    method: 'get',
    params
  })
}
// 导出供应商 Excel
export function exportSupplierExcel(params) {
  return request({
    url: '/basic/supplier/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}